﻿using System.Diagnostics.CodeAnalysis;

namespace DimensionsHelper.LanguageService.Syntax;

public class MetadataFieldOrReference : AbstractTextRange
{
    internal MetadataFieldOrReference(MetadataFieldReference reference)
    {
        Reference = reference;
        IsFieldReference = true;
    }

    internal MetadataFieldOrReference(MetadataField field)
    {
        Field = field;
        IsField = true;
    }


    [MemberNotNullWhen(true, nameof(Field))]
    [MemberNotNullWhen(false, nameof(Reference))]
    public bool IsField { get; }


    [MemberNotNullWhen(true, nameof(Reference))]
    [MemberNotNullWhen(false, nameof(Field))]
    public bool IsFieldReference { get; }


    public MetadataFieldReference? Reference { get; }


    public MetadataField? Field { get; }
}